

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layuiAdmin 网站用户 iframe 框</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/admin/layuiadmin/layui/css/layui.css" media="all">
</head>
<body>

<div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin" style="padding: 20px 0 0 0;">
    <div class="layui-form-item">
        <label class="layui-form-label">上传图片</label>
        <div class="layui-input-inline">
            <input type="text" name="img" id="img" lay-verify="required" placeholder="请上传文件" autocomplete="off" class="layui-input" >
            <img  id="imgx1" style="width:100px;">
        </div>
        <button style="float: left;" type="button" class="layui-btn" id="layuiadmin-upload-useradmin">上传文件</button>
    </div>

    <input type="hidden" name="id" id="id"/>

    <div class="layui-form-item">
        <label class="layui-form-label">名字</label>
        <div class="layui-input-inline">
            <input type="text" name="title" id="title" placeholder="请输入名字" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-inline">
        <label class="layui-form-label">图片分类</label>
        <div class="layui-input-block">
            <select name="type" id="type">
                <option value=""></option>
                <option value="1">首页轮播图</option>
                <option value="6">首页大方块</option>
                <option value="2">首页按钮小方块</option>
                <option value="3">首页广告图</option>
                <option value="4">套餐轮播图</option>
                <option value="5">套餐广告图</option>
            </select>
        </div>
    </div>
    <div style="height:20px;"></div>
    <div class="layui-inline">
        <label class="layui-form-label">打开方式(仅app有效)</label>
        <div class="layui-input-block">
            <select name="style" id="style">
                <option value="1">APP内浏览器</option>
                <option value="2">手机自带浏览器</option>
                <option value="3">APP内方法</option>
                <option value="4">APP内页面</option>
                <option value="5">底部导航栏</option>
            </select>
        </div>
    </div>

    <div style="height:20px;"></div>

    <div class="layui-form-item">
        <label class="layui-form-label">地址</label>
        <div class="layui-input-inline">
            <input type="text" name="url" id="url" lay-verify="required" placeholder="请输入地址" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item" lay-filter="status">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-block">
            <input type="radio" name="status" checked  id="status" value="1" title="显示">
            <input type="radio" name="status" id="status" value="2" title="不显示">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">排序ID</label>
        <div class="layui-input-inline">
            <input type="text" name="paiid" id="paiid" placeholder="排序ID" autocomplete="off" class="layui-input">
        </div>
    </div>


    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="LAY-user-front-submit" id="LAY-user-front-submit" value="确认">
    </div>
</div>

<script src="/admin/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/admin/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'upload','layedit'], function(){
        var $ = layui.$
            ,form = layui.form
            ,upload = layui.upload
            ,layedit = layui.layedit;

        upload.render({
            elem: '#layuiadmin-upload-useradmin' //绑定元素
            ,url: "{:url('/admin/Index/upload')}" //上传接口
            ,ext: 'jpg|png|gif|mp4'//限制文件
            ,accept:'file'
            ,acceptMime: 'image/jpeg,image/png,image/gif,video/mp4'
            ,done: function(res){
                //上传完毕回调
                $(this.item).prev("div").children("input").val(res.filename);
                document.getElementById('imgx1').src = res.img;
                // document.getElementById('img').value = res.filename;
                layer.msg("上传成功");
            }
            ,error: function(){
                //请求异常回调
            }
        });
    })
</script>
</body>
</html>